package xyz.riceball.start;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import xyz.riceball.api.AutoImportRiceBall;
import xyz.riceball.framework.core.auth.NotCheckRightUrlCustomizer;

/**
 * A Camel Application
 */
@SpringBootApplication
@Import(AutoImportRiceBall.class)
public class RiceBallMainApp {

    /**
     * A main() so we can easily run these routing rules in our IDE
     */
    public static void main(String... args) {
        SpringApplication.run(RiceBallMainApp.class, args);
    }


    @Bean
    @ConditionalOnMissingBean(value = NotCheckRightUrlCustomizer.class)
    public NotCheckRightUrlCustomizer addNotCheckRightUrl() {
        return notCheckRightUrls -> {
            notCheckRightUrls.add("/rb/api/test/123");
            notCheckRightUrls.add("/rb/api/generator/code");
            notCheckRightUrls.add("/rb/api/commonApi/executeQuery");
        };
    }
}

